package cn.com.cym.gamezao.entity.demo;

import cn.com.cym.gamezao.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.io.Serializable;

@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor
@Entity
@Table(name ="x_child")
@ApiModel(description = "子类")
public class Child extends BaseEntity implements Serializable {
    private static final long serialVersionUID = -6753571267769128145L;

    @Column(length = 60)
    private String name;

    @Column(length = 60)
    private String code;

    @Column(length = 60)
    private String item;

    /**
     * JsonProperty 中access 用于处理序列化的状态
     */
    @JoinColumn(name = "parent_id")
    @ManyToOne
    //@JsonIgnore
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Parent parent;
}
